package com.harassment.interception.ui.fragments.listManagement.dialogFragments;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;

import com.harassment.interception.R;
import com.harassment.interception.ui.fragments.dialogFragments.OnItemClickListener;

public class SelectActionDialog extends DialogFragment implements View.OnClickListener {
    public static final String TAG = "SelectActionDialog";
    private OnItemClickListener mOnItemClickListener;
    private int itemPosition;

    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Activity activity = getActivity();
        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        LayoutInflater layoutInflater = activity.getLayoutInflater();
        View view = layoutInflater.inflate(R.layout.dialog_select_action, null);
        builder.setTitle(R.string.select_action)
                .setView(view);

        view.findViewById(R.id.select_update).setOnClickListener(this);
        view.findViewById(R.id.select).setOnClickListener(this);
        return builder.create();
    }

    @Override
    public void onClick(View v) {
        if (mOnItemClickListener != null) {
            mOnItemClickListener.onItemClickListener(v);
        }
    }

    public OnItemClickListener getOnItemClickListener() {
        return mOnItemClickListener;
    }

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        mOnItemClickListener = onItemClickListener;
    }

    public int getItemPosition() {
        return itemPosition;
    }

    public void setItemPosition(int itemPosition) {
        this.itemPosition = itemPosition;
    }

}
